//
//  SJPApplyViewController.m
//  SWS_Project00
//
//  Created by 马继鵬 on 17/3/10.
//  Copyright © 2017年 SWS. All rights reserved.
//

#import "SJPApplyViewController.h"
#import "SJPApplyModel.h"
@interface SJPApplyViewController ()

@end

@implementation SJPApplyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationController.navigationBar.translucent = NO;
    [self setupUI];
    self.title = @"预约医生信息详情";
    
    self.navigationItem.hidesBackButton = YES;
    UIImage* backImage = [UIImage imageNamed:@"jiantou"];
    
    UIBarButtonItem* backBar = [[UIBarButtonItem alloc]initWithImage:backImage style:UIBarButtonItemStyleDone target:self action:@selector(backToHome)];
    self.navigationItem.leftBarButtonItem = backBar;
    self.navigationController.navigationBar.barTintColor = kThemeColor;
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self.navigationItem.leftBarButtonItem setTintColor:[UIColor whiteColor]];
}
- (void)backToHome
{
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma
#pragma-设置UI
- (void)setupUI{
#pragma
#pragma-设置图片
    UIImageView* iconView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"banner"]];
    [self.view addSubview:iconView];
    
    [iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.top.offset(17);
        make.width.height.mas_equalTo(40);
    }];
#pragma
#pragma-姓名标签
    UILabel* nameLabel = [UILabel EPM_labelWithTitle:_model.name textColor:[UIColor blackColor] font:17];
    [self.view addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(iconView.mas_trailing).offset(27);
        make.top.equalTo(iconView);
    }];
    
#pragma
#pragma-病症标签
    UILabel* illLabel = [UILabel EPM_labelWithTitle:_model.ill textColor:[UIColor grayColor] font:17];
    [self.view addSubview:illLabel];
    [illLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(nameLabel.mas_trailing).offset(27);
        make.centerY.equalTo(nameLabel);
    }];
#pragma
#pragma-设置时间标签
    UILabel* timeLabel = [UILabel EPM_labelWithTitle:_model.time textColor:[UIColor grayColor] font:17];
    [self.view addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(nameLabel);
        make.bottom.equalTo(iconView);
    }];
#pragma
#pragma-设置状态标签
    UILabel* statueLabel = [UILabel EPM_labelWithTitle:_model.statue textColor:[UIColor whiteColor] font:14];
    [self.view addSubview:statueLabel];
    statueLabel.textAlignment = NSTextAlignmentCenter;
    statueLabel.backgroundColor = [UIColor EPM_colorWithHex:0x66ccff];
    [statueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.offset(-27);
        make.centerY.equalTo(iconView);
        make.width.height.mas_equalTo(50);
    }];
    statueLabel.layer.cornerRadius = 25;
    statueLabel.layer.masksToBounds = YES;
    
    
#pragma
#pragma-设置第一个分割线
    UIImageView* firstLine = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"fengexian"]];
    [self.view addSubview:firstLine];
    [firstLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(iconView.mas_bottom).offset(17);
        make.leading.trailing.offset(0);
        make.height.mas_equalTo(1);
    }];
#pragma
#pragma-预约标签
    UILabel* orderLabel = [UILabel EPM_labelWithTitle:@"预约医生:" textColor:[UIColor grayColor] font:17];
    [self.view addSubview:orderLabel];
    [orderLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.offset(17);
        make.top.equalTo(firstLine.mas_bottom).offset(10);
        
    }];
#pragma
#pragma-第二根分割线
    UIImageView* secondLine = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"fengexian"]];
    [self.view addSubview:secondLine];
    [secondLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(orderLabel.mas_bottom).offset(10);
        make.leading.trailing.offset(0);
        make.height.mas_equalTo(1);
    }];
#warning--- 设置医生信息
#pragma
#pragma-设置医生标签
    UILabel* doctorLabel = [UILabel EPM_labelWithTitle:_model.doctor textColor:[UIColor blackColor] font:17];
    [self.view addSubview:doctorLabel];
    [doctorLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.offset(17);
        make.top.equalTo(secondLine.mas_bottom).offset(17);
    }];
#pragma
#pragma-设置头衔标签
    UILabel* titleLabel = [UILabel EPM_labelWithTitle:_model.title textColor:[UIColor grayColor] font:17];
    [self.view addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(doctorLabel.mas_trailing).offset(27);
        make.centerY.equalTo(doctorLabel);
    }];
#pragma
#pragma-添加医院标签
    UILabel* hospitalLabel = [UILabel EPM_labelWithTitle:_model.hospital textColor:[UIColor grayColor] font:17];
    [self.view addSubview:hospitalLabel];
    [hospitalLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(doctorLabel);
        make.top.equalTo(doctorLabel.mas_bottom).offset(17);
    }];
#pragma
#pragma-设置递交反馈按键
    UIButton* feedBackBtn = [[UIButton alloc]init];
    [self.view addSubview:feedBackBtn];
    [feedBackBtn setTitle:@"递交反馈" forState:UIControlStateNormal];
    [feedBackBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [feedBackBtn setTitleColor:[UIColor blackColor] forState:UIControlStateSelected];
    feedBackBtn.backgroundColor = [UIColor EPM_colorWithHex:0x66ccff];
    feedBackBtn.titleLabel.font = [UIFont systemFontOfSize:17];
    [feedBackBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(doctorLabel.mas_centerY);
        make.bottom.equalTo(hospitalLabel.mas_centerY);
        make.trailing.equalTo(statueLabel);
    }];
    //设置圆角
    feedBackBtn.layer.cornerRadius = 5;
    feedBackBtn.layer.masksToBounds = YES;
#pragma
#pragma-设置第三分割线
    UIImageView* thirdLine = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"fengexian"]];
    [self.view addSubview:thirdLine];
    [thirdLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(hospitalLabel.mas_bottom).offset(17);
        make.leading.trailing.offset(0);
        make.height.mas_equalTo(1);
    }];
#warning 设置预约信息
#pragma
#pragma-设置提醒标签
    UILabel* noticeLabel = [UILabel EPM_labelWithTitle:@"预约须知:" textColor:[UIColor grayColor] font:17];
    [self.view addSubview:noticeLabel];
    [noticeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.offset(17);
        make.top.equalTo(thirdLine.mas_bottom).offset(10);
    }];
#pragma
#pragma-设置第四根分割线
    UIImageView* fourthLine = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"fengexian"]];
    [self.view addSubview:fourthLine];
    [fourthLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(noticeLabel.mas_bottom).offset(10);
        make.leading.trailing.offset(0);
        make.height.mas_equalTo(1);
    }];
#pragma
#pragma-添加就诊地点
    UILabel* addressLabel =[UILabel EPM_labelWithTitle:@"就诊地点:" textColor:[UIColor blackColor] font:17];
    [self.view addSubview:addressLabel];
    [addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.offset(17);
        make.top.equalTo(fourthLine.mas_bottom).offset(17);
    }];
#pragma
#pragma-添加详细地址
    UILabel* adrrDetailLabel = [UILabel EPM_labelWithTitle:@"上海长征医院2号楼心血管内科" textColor:[UIColor grayColor] font:17];
    [self.view addSubview:adrrDetailLabel];
    [adrrDetailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(addressLabel.mas_trailing).offset(27);
        make.centerY.equalTo(addressLabel);
    }];
#pragma
#pragma-取号时间标签
    UILabel* timeNoticeLabel = [UILabel EPM_labelWithTitle:@"取号时间:" textColor:[UIColor blackColor] font:17];
    [self.view addSubview:timeNoticeLabel];
    [timeNoticeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.offset(17);
        make.top.equalTo(addressLabel.mas_bottom).offset(17);
    }];
#pragma
#pragma-时间详情
    UILabel* onworktimeLabel = [UILabel EPM_labelWithTitle:@"9:00 - 10:00" textColor:[UIColor grayColor] font:17];
    [self.view addSubview:onworktimeLabel];
    [onworktimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(timeNoticeLabel.mas_trailing).offset(27);
        make.centerY.equalTo(timeNoticeLabel);
    }];
#pragma
#pragma-设置取号地址标签
    UILabel* rowAddressLabel = [UILabel EPM_labelWithTitle:@"取号地址" textColor:[UIColor blackColor] font:17];
    [self.view addSubview:rowAddressLabel];
    [rowAddressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(timeNoticeLabel.mas_bottom).offset(17);
        make.leading.offset(17);
    }];
#pragma
#pragma-设置取号地址详情
    UILabel* rowAddressDetailLabel = [UILabel EPM_labelWithTitle:@"上海长征医院住院部" textColor:[UIColor grayColor] font:17];
    [self.view addSubview:rowAddressDetailLabel];
    [rowAddressDetailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(rowAddressLabel.mas_trailing).offset(27);
        make.centerY.equalTo(rowAddressLabel);
    }];
    
#pragma
#pragma-设置第五根分割线
    UIImageView* fifthLine = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"fengexian"]];
    [self.view addSubview:fifthLine];
    [fifthLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(rowAddressLabel.mas_bottom).offset(17);
        make.leading.trailing.offset(0);
        make.height.mas_equalTo(1);
    }];
#pragma
#pragma-设置重发按键
    UIButton* resenderBtn = [[UIButton alloc]init];
    [self.view addSubview:resenderBtn];
    [resenderBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.offset(17);
        make.trailing.equalTo(self.view.mas_centerX).offset(-17);
        make.bottom.offset(-17);
        make.height.mas_equalTo(30);
    }];
    [resenderBtn setTitle:@"短信重发" forState:UIControlStateNormal];
    [resenderBtn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [resenderBtn setTitleColor:[UIColor blackColor] forState:UIControlStateSelected];
    //设置按钮边框颜色
    [resenderBtn.layer setBorderWidth:1.0];
    [resenderBtn.layer setBorderColor:[UIColor greenColor].CGColor];
    //设置圆角
    resenderBtn.layer.cornerRadius = 5;
    resenderBtn.layer.masksToBounds = YES;
#pragma
#pragma-设置取消按钮
    UIButton* cancelBtn = [[UIButton alloc]init];;
    [self.view addSubview:cancelBtn];
    [cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.bottom.offset(-17);
        make.leading.equalTo(self.view.mas_centerX).offset(17);
    }];
    [cancelBtn setTitle:@"取消预约" forState:UIControlStateNormal];
    cancelBtn.tintColor = [UIColor greenColor];
    [cancelBtn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [cancelBtn setTitleColor:[UIColor blackColor] forState: UIControlStateSelected];
    //设置边框颜色
    [cancelBtn.layer setBorderWidth:1.0];
    [cancelBtn.layer setBorderColor:[UIColor greenColor].CGColor];
    //设置圆角
    cancelBtn.layer.cornerRadius = 5;
    cancelBtn.layer.masksToBounds = YES;
    
}




@end
